
<template>
  <div>
    <Modal
      v-model="showBox"
      title="开票信息"
      :footer-hide="true"
      :mask-closable="false"
      @on-visible-change="vChange"
      width="500"
    >
      <Input v-model="company_title" placeholder="请输入开票抬头" ref="company_title" class="marginB20" size="large" clearable>
        <Icon type="ios-home" slot="prefix" />
      </Input>
      <Input v-model="invoice_number" placeholder="请输入纳税人识别号" ref="invoice_number" class="marginB20" size="large" clearable>
        <Icon type="md-card" slot="prefix" />
      </Input>
      

      <Button type="primary" class="marginB10" size="large" long @click="goFun">确 定</Button>
    </Modal>
  </div>
</template>



<script>
export default {
  name: "invoiceSet",
  components: {},
  data() {
    return {
      // 弹框是否显示
      showBox: false,
      invoice_number:'',//税号
      company_title:''//公司抬头
    };
  },
  created(){ },
  mounted() {},
  methods: {
    //提交
    goFun() {
      let that=this;
      let {
        invoice_number,
        company_title
      }=that;
      if(!$app.judgeData($app.delSpace(company_title))){
        that.$Message.error({content:'开票抬头不能为空'});
        that.$refs['company_title'].focus();
      }else if(!$app.judgeData($app.delSpace(invoice_number))){
        that.$Message.error({content:'纳税人识别号不能为空'});
        that.$refs['invoice_number'].focus();
      }else{
        $ajax.yYinvoice(company_title,invoice_number,that,()=>{
          this.$parent.$emit('up_cAll');// 更新 companyAll数据
          that.showBox=false;
        });
      }
    },

    //弹框显示+隐藏
    vChange(buEr) {
      if(!buEr){
        
        
      }else{
        $ajax.pInfo(resData => {
          let {
            invoice_number,
            company_title
          }=resData;
          this.invoice_number=invoice_number;
          this.company_title=company_title;
        });
      }
    }
  }
};
</script>

<style>
</style>
